package prototipo.server.logic;

import prototipo.server.db.exception.ExceptionDB;
import prototipo.server.logic.exception.ExceptionLogic;
import prototipo.server.logic.item.ProductIF;
import prototipo.server.logic.item.RawIF;
import prototipo.server.logic.person.ClientIF;
import prototipo.server.logic.person.Supplier;
import prototipo.server.logic.person.SupplierIF;
import prototipo.server.logic.transaction.InputIF;
import prototipo.server.logic.transaction.OutputIF;
import prototipo.server.logic.user.UserIF;
import prototipo.server.logic.util.PasswordIF;

public class LogicFacade implements LogicIF {

	private static LogicFacade instance = null;
	private LogicIF systemLogic;

	public LogicFacade() throws ExceptionDB {
		this.systemLogic = new Logic();
	}

	public LogicFacade getInstance() throws ExceptionDB {
		if (instance == null)
			instance = new LogicFacade();
		return instance;
	}

	@Override
	public int login(String login, PasswordIF password) throws ExceptionLogic,
			ExceptionDB {
		return systemLogic.login(login, password);
	}

	@Override
	public boolean logout(int sessionID) throws ExceptionLogic {
		return systemLogic.logout(sessionID);
	}

	@Override
	public boolean removeUser(int sessionID, int userID) throws ExceptionLogic,
			ExceptionDB {
		return systemLogic.removeUser(sessionID, userID);
	}

	@Override
	public boolean editUser(int sessionID, int userID, UserIF editedUser)
			throws ExceptionLogic, ExceptionDB {
		return systemLogic.editUser(sessionID, userID, editedUser);
	}

	@Override
	public int registerUser(int sessionID, UserIF newUser)
			throws ExceptionLogic, ExceptionDB {
		return systemLogic.registerUser(sessionID, newUser);
	}

	@Override
	public long registerSupplier(int sessionID, SupplierIF newSupplier)
			throws ExceptionLogic, ExceptionDB {
		return systemLogic.registerSupplier(sessionID, newSupplier);
	}

	@Override
	public boolean editSupplier(int sessionID, long supplierID,
			SupplierIF editedSupplier) throws ExceptionLogic, ExceptionDB {
		return systemLogic.editSupplier(sessionID, supplierID, editedSupplier);
	}

	@Override
	public boolean removeSupplier(int sessionID, long supplierID)
			throws ExceptionLogic, ExceptionDB {
		return systemLogic.removeSupplier(sessionID, supplierID);
	}

	@Override
	public long registerClient(int sessionID, ClientIF newClient)
			throws ExceptionLogic, ExceptionDB {
		return systemLogic.registerClient(sessionID, newClient);
	}

	@Override
	public boolean editClient(int sessionID, long clientID,
			ClientIF editedClient) throws ExceptionLogic, ExceptionDB {
		return systemLogic.editClient(sessionID, clientID, editedClient);
	}

	@Override
	public boolean removeClient(int sessionID, long clientID)
			throws ExceptionLogic, ExceptionDB {
		return systemLogic.removeClient(sessionID, clientID);
	}

	@Override
	public long registerRaw(int sessionID, RawIF newRaw) throws ExceptionLogic,
			ExceptionDB {
		return systemLogic.registerRaw(sessionID, newRaw);
	}

	@Override
	public int increaseRaw(int sessionID, int rawID, int quant)
			throws ExceptionLogic, ExceptionDB {
		return systemLogic.increaseRaw(sessionID, rawID, quant);
	}

	@Override
	public int decrementRaw(int sessionID, int rawID, int quant)
			throws ExceptionLogic, ExceptionDB {
		return systemLogic.decrementRaw(sessionID, rawID, quant);
	}

	@Override
	public boolean editRaw(int sessionID, int rawID, RawIF editedRaw)
			throws ExceptionLogic, ExceptionDB {
		return systemLogic.editRaw(sessionID, rawID, editedRaw);
	}

	@Override
	public boolean removeRaw(int sessionID, int rawID) throws ExceptionLogic,
			ExceptionDB {
		return systemLogic.removeRaw(sessionID, rawID);
	}

	@Override
	public long registerProduct(int sessionID, ProductIF newProduct)
			throws ExceptionLogic, ExceptionDB {
		return systemLogic.registerProduct(sessionID, newProduct);
	}

	@Override
	public boolean removeProduct(int sessionID, int productID)
			throws ExceptionLogic, ExceptionDB {
		return systemLogic.removeProduct(sessionID, productID);
	}

	@Override
	public boolean editProduct(int sessionID, int productID,
			ProductIF editedProduct) throws ExceptionLogic, ExceptionDB {
		return systemLogic.editProduct(sessionID, productID, editedProduct);
	}

	@Override
	public int decrementProduct(int sessionID, int productID, int quant)
			throws ExceptionLogic, ExceptionDB {
		return systemLogic.decrementProduct(sessionID, productID, quant);
	}

	@Override
	public int increaseProduct(int sessionID, int productID, int quant)
			throws ExceptionLogic, ExceptionDB {
		return systemLogic.increaseProduct(sessionID, productID, quant);
	}

	public SupplierIF getSupplierById(int sessionID, int supplierID)
			throws ExceptionLogic, ExceptionDB {
		return systemLogic.getSupplierById(sessionID, supplierID);
	}

	@Override
	public boolean editInput(int sessionID, long inputID, InputIF editedInput)
			throws ExceptionLogic, ExceptionDB {
		return systemLogic.editInput(sessionID, inputID, editedInput);
	}

	@Override
	public boolean editOutput(int sessionID, long outputID,
			OutputIF editedOutput) throws ExceptionLogic, ExceptionDB {
		return systemLogic.editOutput(sessionID, outputID, editedOutput);
	}

	@Override
	public long registerInput(int sessionID, InputIF input)
			throws ExceptionLogic, ExceptionDB {
		return systemLogic.registerInput(sessionID, input);
	}

	@Override
	public long registerOutput(int sessionID, OutputIF output)
			throws ExceptionLogic, ExceptionDB {
		return systemLogic.registerOutput(sessionID, output);
	}

	@Override
	public boolean removeInput(int sessionID, long inputID)
			throws ExceptionLogic, ExceptionDB {
		return systemLogic.removeInput(sessionID, inputID);
	}

	@Override
	public boolean removeOutput(int sessionID, long outputID)
			throws ExceptionLogic, ExceptionDB {
		return systemLogic.removeOutput(sessionID, outputID);
	}

	@Override
	public boolean addPermission(int sessionID, int userID, String operation)
			throws ExceptionLogic, ExceptionDB {
		return systemLogic.addPermission(sessionID, userID, operation);
	}

	@Override
	public boolean removePermission(int sessionID, int userID, String operation)
			throws ExceptionLogic, ExceptionDB {
		return systemLogic.removePermission(sessionID, userID, operation);
	}
}
